package com.lebang.controller.api.bus;

import com.lebang.common.Require;
import com.lebang.feign.bus.MemberBussSiteRecordFeign;
import com.lebang.model.RequestUserInfo;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 公交用户搜索站点记录
 *
 * @Author: ljx
 * @Date: 2020/11/30
 */
@Api(tags = "公交用户搜索站点记录")
@RestController
@RequestMapping("/api/siterecord")
public class MemberBussSiteRecordApi {
    @Autowired
    private MemberBussSiteRecordFeign feign;

    @Require
    @ApiOperation("添加车站站地点记录")
    @PostMapping("/add")
    public JsonData add(HttpServletRequest request,
                        @ApiParam(name = "位置") @RequestParam("site") String site,
                        @ApiParam(name = "信息") @RequestParam("message") String message,
                        @ApiParam(name = "类型") @RequestParam("type") Integer type,
                        @ApiParam(name = "标识") @RequestParam("poiId") String poiId,
                        @ApiParam(name = "城市id") @RequestParam(value = "cityId") String cityId) {
        RequestUserInfo userInfo = new RequestUserInfo(request);
        return feign.add(userInfo, site, message, type, poiId, cityId);
    }

    @Require
    @ApiOperation("删除车站站地点记录")
    @PostMapping("/delone")
    public JsonData delOne(HttpServletRequest request, @ApiParam(name = "标识") @RequestParam("poiId") String poiId, @ApiParam(name = "城市id") @RequestParam(value = "cityId") String cityId) {
        RequestUserInfo userInfo = new RequestUserInfo(request);
        return feign.delOne(userInfo, poiId, cityId);
    }
}
